package com.neuedu.my12306;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class LoginActivity extends Activity {

	Button btnLogin;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_login);
		// 获取组件对象
		btnLogin = (Button)findViewById(R.id.btnLogin);
		// 绑定监听器
		btnLogin.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Log.d("My12306", "Login Button Click");
				// 显式意图
//				Intent intent = new Intent();
//				intent.setClass(LoginActivity.this, MainActivity.class);
//				startActivity(intent);

				// 隐式意图
				Intent intent = new Intent();
				intent.setAction("aa");
				intent.addCategory("bb");
				startActivity(intent);

				// 关闭LoginActivity
				finish();
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.login, menu);
		return true;
	}

}
